package com.wtb.javatool.service;

import com.wtb.javatool.common.PageBean;
import com.wtb.javatool.common.R;
import com.wtb.javatool.dto.ProjectDto;
import com.wtb.javatool.dto.TeamDto;
import com.wtb.javatool.dto.UserDto;
import com.wtb.javatool.entity.Course;
import com.wtb.javatool.entity.Project;
import com.wtb.javatool.vo.CourseTaskListCard;

import java.util.List;

public interface ProjectService {

    int createProject(Project project, List<Long> userIds, Integer projectType);

    PageBean<Project> findProjectsByUserId(Long userId,
                                           String projectName,
                                           Integer projectType,
                                           Integer projectStatus,
                                           List<Long> projectDate,
                                           Integer currentPage,
                                           Integer pageSize);


    ProjectDto findProjectByProjectId(Long projectId, int projectType);

    List<UserDto> findProjectMemberByProjectId(Long projectId, String userName);

    List<TeamDto> findProjectTeamsAndMembersByProjectId(Long projectId, Long courseId);

    void upsertDeleteUsers(Long projectId, List<UserDto> frontendUsers);

    void updateProject(Project project);

    void upsertDeleteCourses(Long projectId, List<Course> frontendCourses);
    
    /**
     * 根据项目ID删除项目及其关联的所有数据
     * 
     * @param projectId 项目ID
     */
    void deleteProject(Long projectId);
    
    /**
     * 根据课程ID查询关联的项目
     *
     * @param courseId 课程ID
     * @param projectName 项目名称（可选，用于过滤）
     * @param projectStatus 项目状态（可选，用于过滤）
     * @param currentPage 当前页数
     * @param pageSize 每页显示数量
     * @return 包含项目列表的分页对象
     */
    PageBean<Project> findProjectsByCourseId(
            Long courseId,
            String projectName,
            Integer projectStatus,
            Integer currentPage,
            Integer pageSize);
    
    /**
     * 从课程中移除项目
     *
     * @param courseId 课程ID
     * @param projectId 项目ID
     */
    void removeProjectFromCourse(Long courseId, Long projectId);
    
    /**
     * 获取可添加到课程的项目列表
     * 查询用户有权限访问但尚未关联到指定课程的项目
     *
     * @param userId 用户ID
     * @param courseId 课程ID
     * @return 可添加的项目列表
     */
    List<Project> getAvailableProjectsForCourse(Long userId, Long courseId);
}
